/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.sunspotworld.demo;

import java.util.*;

/**
 *
 * @author kyle.murphy
 */
public class AVManager {
    private static Vector m_vector = new Vector();

    public synchronized static void add(AV av)
    {
        m_vector.addElement(av);
    }

    public synchronized static void clear()
    {
        m_vector.removeAllElements();
    }

    public static float getAverageValence()
    {
        float averageValence = 0.0f;
        int size = m_vector.size();

        for(int i = 0; i < size; i++)
        {
            averageValence += ((AV)m_vector.elementAt(i)).getValence();
        }

        return averageValence / (float) size;
    }

    public static float getAverageArousal()
    {
        float averageArousal = 0.0f;
        int size = m_vector.size();

        for(int i = 0; i < size; i++)
        {
            averageArousal += ((AV)m_vector.elementAt(i)).getArousal();
        }
        
        return averageArousal / (float) size;
    }
}
